package com.cuitrip.util;

import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;

import com.cuitrip.business.user.proxy.UserInfoProxy;
import com.cuitrip.service.R;
import com.lab.rtenvironment.AppCoreRuntime;

/**
 * Created by ak on 15/10/19.
 */
public class ResourceUtil {

    @NonNull
    public static final String getString(@StringRes int stringResId){
        if (stringResId <= 0){
            return "";
        }
        return AppCoreRuntime.context.getString(stringResId);
    }


    public static final String getString(@StringRes int stringResId, Object...objects){
        if (stringResId <= 0){
            return "";
        }
        return AppCoreRuntime.context.getString(stringResId, objects);
    }

    public static final Drawable getDrawable(@DrawableRes int drawResId){
        return AppCoreRuntime.context.getResources().getDrawable(drawResId);
    }


    public static final int getColor(@ColorRes int colorResId){
        if (colorResId <= 0){
            return 0;
        }
        return AppCoreRuntime.context.getResources().getColor(colorResId);
    }

    public static final int getThemeColor(){
        if (UserInfoProxy.getInstance().isTraveller()){
            return AppCoreRuntime.context.getResources().getColor(R.color.orange_ff6855);
        }else{
            return AppCoreRuntime.context.getResources().getColor(R.color.sky_blue_00d4ff);
        }

    }

    public static final int getThemeSolidButtonDrawableRes(){
        if (UserInfoProxy.getInstance().isTraveller()){
            return R.drawable.selector_orange_rec_corner;
        }else{
            return R.drawable.selector_blue_rec_corner;
        }

    }

    public static final int getThemeWhiteButtonDrawableRes(){
        if (UserInfoProxy.getInstance().isTraveller()){
            return R.drawable.selector_white_corner_orange_line;
        }else{
            return R.drawable.selector_white_corner_blue_line;
        }

    }

    public static final int getThemeColorRes(){
        if (UserInfoProxy.getInstance().isTraveller()){
            return R.color.orange_ff6855;
        }else{
            return R.color.sky_blue_00d4ff;
        }

    }
}
